package com.miniapp.controller;

import com.miniapp.dto.AttachmentDTO;
import com.miniapp.entity.*;
import com.miniapp.service.*;
import com.miniapp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController()
@RequestMapping("/sys/attachment")
public class MiniAttachmentController extends AbstractController {

    @Autowired
    MiniAttachmentService miniAttachmentService;
    /**
     * 所有配置列表
     */
    @PostMapping("/list")
    public R list(@RequestBody AttachmentDTO attachmentDTO){

        attachmentDTO.setUserId(this.getUserId());
        List<MiniAttachmentEntity> miniAttachments = miniAttachmentService.findByAttachmentDTO(attachmentDTO);

        return R.ok().put("items", miniAttachments);
    }
}
